package com.xieyong.leetcode;

public class Leetcode3423 {
    public static void main(String[] args) {
        Leetcode3423 leetcode3423 = new Leetcode3423();
        int[] nums = {1,2,4};
        int i = leetcode3423.maxAdjacentDistance(nums);
        System.out.println(i);
    }


    public int maxAdjacentDistance(int[] nums) {
        int res = Math.abs(nums[nums.length - 1] - nums[0]);
        for (int i = 0; i < nums.length - 1; i++) {
            res = Math.max(res, Math.abs(nums[i] - nums[i + 1]));
        }
        return res;
    }
}
